package cn.admin.remoting;

import java.util.Map;

public interface IOEventListener {

    interface ConnectionMsgReceivedListener extends IOEventListener {

        void messageReceived(Connection connection, Object message) throws Exception;

        void registerProcessor(RequestProcessor<?> processor);

        <T> RequestProcessor<T> removeProcessor(Class<T> appRequestClazz);

        Map<Class<?>,RequestProcessor<?>> getProcessors();

        void updateProcessors(Map<Class<?>, RequestProcessor<?>> newProcessors);

    }

    interface ConnectionLifecycleListener extends IOEventListener {

        void connectionOpened(Connection connection);

        void connectionClosed(Connection connection);

    }

    interface ConnectionIdleListener extends IOEventListener {

        void connectionIdle(Connection connection);

    }

}
